package com.itheima01;

import 预习的.Phone;

import java.util.ArrayList;

public class 改错 {
    public static void main(String[] args) {
        ArrayList<Phone> list = new ArrayList<>();
        Phone p1 = new Phone("小米","蓝色",4000);
        Phone p2 = new Phone("小米","蓝色",4000);
        Phone p3 = new Phone("小米","蓝色",4000);

        list.add(p1);
        list.add(p2);
        list.add(p3);
        ArrayList<Phone> al = filter(list,2000);

        System.out.println(al);

    }
    public static ArrayList<Phone> filter(ArrayList<Phone> list,double price){
        ArrayList<Phone> al  = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getPrice()>price){
                al.add(list.get(i));
            }
        }
        return al;
    }
}
